package com.xbell.app.cfg;


import org.springframework.context.annotation.Configuration;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Contact;
import io.swagger.v3.oas.annotations.info.Info;
import springfox.documentation.oas.annotations.EnableOpenApi;


//import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
//import org.springframework.cloud.client.loadbalancer.LoadBalanced;

/**
 * @author 王文胜
 * @date 2020年11月7日-下午11:02:18
 */
//@Configuration
@EnableOpenApi
@OpenAPIDefinition(info=@Info(title="appone的项目",description="描述",version = "1.0",contact = @Contact(name="王文胜")))
public class SwaggerConfig{
	/*
    //配置swagger的Docket的bean实例
    @Bean
    public Docket docket1(Environment environment){

        //设置要显示的swagger环境
        Profiles profiles = Profiles.of("dev","test");

        //通过environment.acceptsProfiles判断是否处在自己设定的环境当中
        boolean flag = environment.acceptsProfiles(profiles);

        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo())
                .enable(flag) //swagger开关
                .groupName("项目组1")
                .select()
                //RequestHandlerSelectors,配置要扫描接口的方式
                //basePackage() 指定要扫描的包
                //any()：扫描全部
                //none();不扫描
                //withClassAnnotation:扫描类上的注解
                //withMethodAnotation: 扫描方法上的注解
                .apis(RequestHandlerSelectors.basePackage("com.ljy.swagger3.controller"))
                //paths() 过滤什么路径
                //.paths(PathSelectors.ant("/kuang/**"))
                .build();
    }

    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.OAS_30).groupName("项目组2");
    }

    @Bean
    public Docket docket2(){
        return new Docket(DocumentationType.OAS_30).groupName("项目组3");
    }

    //配置Swagger信息 apiInfo
    private ApiInfo apiInfo(){
        //作者信息
        Contact contact =new Contact("王文胜","http://www.xbellsoft.com","724422769@qq.com");

        return new ApiInfo("廖家银的api文档 ",
                "非常可爱的描述",
                "1.0",
                "urn:tos",
                contact, "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList());
    }
    */

}
